![]() |
YieldToThread |
||||
Header: | Threads.h | Carbon status: | Supported | |
Relinquishes the current threadís control to a particular thread.
OSErr YieldToThread ( ThreadID suggestedThread );
The ID of the thread to yield control to.
A result code.
The YieldToThread function invokes the Thread Managerís scheduling mechanism. The current thread relinquishes control and passes the thread ID of a thread for the Thread Manager to schedule. The Thread Manager schedules this thread if it is available. Otherwise, the Thread Manager schedules the next available thread.
The current thread is suspended in the ready state and awaits rescheduling when the CPU is available. When the suspended thread is scheduled again, YieldToThread regains control and returns to the function that called it.
If you have installed a custom scheduler, the Thread Manager passes it the thread ID of the suspended thread.
In each thread you must make one or more strategically placed calls to relinquish control to another thread. You can either make this yield call or another yield call such as YieldToAnyThread; or you can make a call such as SetThreadState to explicitly change the state of the thread.
Threads must yield in the CPU addressing mode (24-bit or 32-bit) in which the application was launched.
To relinquish control without naming a specific thread, use the YieldToAnyThread function.
To change the state of a specified thread, use the SetThreadState function.
Supported in Carbon. Available in CarbonLib 1.0 and later when ThreadsLib 1.0 or later is installed. Exported by CarbonLib 1.0 and later and by ThreadsLib 1.0 and later.
© 2000 Apple Computer, Inc. — (Last Updated 3/8/2000)